package com.xmg.day04;

import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.OpenOption;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

/**
 * @Author: mazhongqing
 * @Date: 2020/10/22 10:53
 */
public class StaticDCLDemo {

    private static final StaticDCLDemo instance = new StaticDCLDemo();
    
    private StaticDCLDemo(){}
    
    private static class SingleHolder{
        private static final StaticDCLDemo ins = new StaticDCLDemo();
    }
    
    public static StaticDCLDemo getInstance(){
        return SingleHolder.ins;
    }

    public static void main(String[] args) {
//        for (int i = 0; i <1000 ; i++) {
//            new Thread(()->{
//                System.out.println(StaticDCLDemo.getInstance().hashCode());
//            }).start();
//        }

//        for (int i = 0; i < 100; i++) {
//            System.out.println(SingletonEnumDemo.INSTANCE.getResourceInstance().hashCode());
//            System.out.println(SingletonEnumDemo.INSTANCE.getmInstance().hashCode());
//        }
        try {
            FileChannel.open(Paths.get(""), StandardOpenOption.READ);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
